import re

pattern = '\d\.\d+'

s = 'May the force be with you3.11 the young skywalker2.7 dark side'
match = re.search(pattern, s)
print(match)                        # <re.Match object; span=(25, 29), match='3.11'>

s2 = '4.10 The force power of dark side'
s3 = 'The force power of dark side'
match2 = re.search(pattern, s2)
match3 = re.search(pattern, s3)
print(match)                        # <re.Match object; span=(25, 29), match='3.11'>
print(match2)                       # <re.Match object; span=(0, 4), match='4.10'>
print(match3)                       # None

print(match.group())                # 3.11
print(match2.group())               # 4.10

